def findMinAndMax_1(L):
	if len(L) == 0:
		return (None, None)
	min = L[0]
	max = L[0]
	for i in L:
		if i < min:
			min = i
		if i > max:
			max = i
	return(min, max)

def findMinAndMax_2(L):
	if len(L) == 0:
		return (None, None)
	return(min(L), max(L))

def findMinAndMax(L):
	if False:
		return findMinAndMax_1(L)
	else:
		return findMinAndMax_2(L)

#测试
if findMinAndMax([]) != (None, None):
	print('1. 测试失败!')
elif findMinAndMax([7]) != (7, 7):
	print('2. 测试失败!')
elif findMinAndMax([7, 1]) != (1, 7):
	print('3. 测试失败!')
elif findMinAndMax([7, 1, 3, 9, 5]) != (1, 9):
	print('4. 测试失败!')
else:
	print('测试成功!')